package app.texas.com.devilfishhouse.View.regitst;

import app.texas.com.devilfishhouse.Base.BaseBean;
import app.texas.com.devilfishhouse.Base.BaseIView;
import app.texas.com.devilfishhouse.Base.BaseModel;
import app.texas.com.devilfishhouse.Base.BasePresenter;
import app.texas.com.devilfishhouse.Base.IModel;

/**
 * Created by solin on 2018/7/15.
 */

public class RegistPresenter extends BasePresenter<BaseBean> {
    RegistModel registModel;
    RegistView registView;

    public RegistPresenter(BaseIView iView) {
        super(iView);
        registView = (RegistView) iView;
    }

    @Override
    public void oncreate() {
        super.oncreate();
    }

    @Override
    public BaseModel getIModel() {
        registModel = new RegistModel();
        return registModel;
    }

    @Override
    public void onResume() {
        super.onResume();
    }

    @Override
    public void onDestory() {
        super.onDestory();
    }

    @Override
    public void performOnClick() {

    }

    /**
     * 获取验证码
     *
     * @param phone
     */
    public void getCode(String phone) {
        registModel.getCode(phone, new IModel.ICallBack() {
            @Override
            public void onResult(Object data) {
                registView.setCode(data);
            }
        });
    }

    /**
     * 注册结果
     *
     * @param phone
     * @param code
     * @param pwd
     * @param zfb
     */
    public void regist(String phone, String code, String pwd, String zfb) {
        registModel.regist(phone, code, pwd, zfb, new IModel.ICallBack() {
            @Override
            public void onResult(Object data) {
                registView.setResult(data);
            }
        });
    }

}
